#include <iostream>
#include <stack>
using namespace std;
class MinStack {
public:
    /** initialize your data structure here. */
    stack<int> *list;
    stack<int> *assist;//辅助栈，用于保存最小值，严格递减数列
    MinStack() {
        list = new stack<int>();
        assist = new stack<int>();
    }
    
    void push(int x) {
        list->push(x);
        if(assist->size()==0)
            assist->push(x);
        else if(x <= assist->top())
            assist->push(x);
    }
    
    void pop() {
        if(list->size()==0)
            return;
        int temp = list->top();
        list->pop();
        if(assist->size()>0 && temp == assist->top())
            assist->pop();
    }
    
    int top() {
        return list->top();
    }
    
    int min() {
        return assist->top();
    }
};
int main() {
    MinStack* obj = new MinStack();
    obj->push(0);
    obj->push(1);
    obj->push(0);
    int param_1 = obj->min();
    obj->pop();
    int param_2 = obj->min();
    cout<<param_1<<" "<<param_2<<endl;
}/**
 * Your MinStack object will be instantiated and called as such:
 * MinStack* obj = new MinStack();
 * obj->push(x);
 * obj->pop();
 * int param_3 = obj->top();
 * int param_4 = obj->min();
 */